using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for adminClass
/// </summary>
public class bzSiteOption
{
    private DataRow siteOption = null;

    //---------stie group
    public struct Group
    {
        private static string _Website = "Website";
        public static string Website { get { return _Website; } }

        private static string _Administrator = "Admin";
        public static string Administrator { get { return _Administrator; } }

        private static string _Limit = "Limit";
        public static string Limit { get { return _Limit; } }

        private static string _Image = "Image";
        public static string Image { get { return _Image; } }

        private static string _TitleProduct = "TitleProduct";
        public static string TitleProduct { get { return _TitleProduct; } }
    }

    //------site note
    public struct Note
    {
        private static string _CloseSite = "CloseSite";
        public static string CloseSite { get { return _CloseSite; } }
        private static string _Product = "Product";
        public static string Product { get { return _Product; } }


        private static string _Template = "Template";
        public static string Template { get { return _Template; } }

        private static string _About = "About";
        public static string About { get { return _About; } }

        private static string _NewsOne = "NewsOne";
        public static string NewsOne { get { return _NewsOne; } }

        private static string _Service = "Service";
        public static string Service { get { return _Service; } }

        private static string _Comman = "Comman";
        public static string Comman { get { return _Comman; } }

        private static string _Brand = "Brand";
        public static string Brand { get { return _Brand; } }


        private static string _Contact = "Contact";
        public static string Contact { get { return _Contact; } }

        private static string _Default = "Default";
        public static string Default { get { return _Default; } }

        private static string _Gallery = "Gallery";
        public static string Gallery { get { return _Gallery; } }

        private static string _AddShop = "AddShop";
        public static string AddShop { get { return _AddShop; } }
        private static string _BuySel = "BuySel";
        public static string BuySel { get { return _BuySel; } }

    }
    private static string _None = string.Empty;
    public static string None { get { return _None; } }


    //-------------------body
    #region body
    public bzSiteOption(string groupOption, string sNote)
	{
        
        this.loadSiteOption(groupOption,sNote);
	}
    private void loadSiteOption(string groupOption, string sNote)
    {
        SqlParameter[] p = new SqlParameter[2];
        p[0] = new SqlParameter("@GroupOption", groupOption);
        p[1] = new SqlParameter("@Note",sNote);
        DataTable dt = new dbConnection().getDataTable("SP_getSiteOption",p);
        DataTable tmp = new DataTable();
        foreach (DataRow dr in dt.Rows)
        {
            DataColumn col = new DataColumn(dr["Name"].ToString(), typeof(string));
            tmp.Columns.Add(col);
        }
        this.siteOption = tmp.NewRow();
        foreach (DataRow dr in dt.Rows)
        {
            this.siteOption[dr["Name"].ToString()] = dr["ValueSelect"].ToString();            
        }        
    }
    public DataRow SiteOption
    {        
        get
        {
            return this.siteOption;
        }
    }
    public string getVisitor(object oSize)
    {
        DataTable dt = new dbConnection().getDataTable("SP_getVisitor");
        try 
        {            
            long i= Convert.ToInt64(dt.Rows[0][0]);
            int size = Convert.ToInt32(oSize);
            string str = "";
            for (int k = size-1; k >=i.ToString().Length ;k-- )          
                str += "0";              
            str += i.ToString();
            return str;
        }
        catch { }
        return "0";
    }
    public int upVisitor()
    {
        return new dbConnection().updateData("SP_upVisitor");
    }
    #endregion body
}
